<script>
init({
  title: 'Smart Display',
  desc: 'Use `smartDisplay` option to display pagination or card view smartly. In this case you can see the changed of the page list.',
  links: ['bootstrap-table.min.css'],
  scripts: ['bootstrap-table.min.js']
})
</script>

<template>
  <div class="toolbar">
    <div class="checkbox">
      <label>
        <input
          type="checkbox"
          checked
        >
        <code>smartDisplay</code>
      </label>
    </div>
  </div>

  <table
    id="table"
    data-height="460"
    data-pagination="true"
    data-toolbar=".toolbar"
    data-url="json/data1.json"
  >
    <thead>
      <tr>
        <th data-field="id">
          ID
        </th>
        <th data-field="name">
          Item Name
        </th>
        <th data-field="price">
          Item Price
        </th>
      </tr>
    </thead>
  </table>
</template>

<script>
  const $table = $('#table')

  function mounted () {
    $table.bootstrapTable()

    $('.toolbar input').change(function () {
      $table.bootstrapTable('destroy').bootstrapTable({
        smartDisplay: $(this).prop('checked')
      })
    })
  }
</script>
